package edu.hawaii.webspider;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import org.junit.Test;

/**
 *  test program which will test the getNumLinks method in the WebSpiderExample class.
 *  
 * @author Hong
 *
 */
public class TestWebSpider {

  private int numLinks;
  
  /**
   *   Test WebSpider getNumLinks method.
   *  
   *   @throws Exception is thrown if test fails. 
   */
  @Test
  public void testNormalOperations()throws Exception {
  
    WebSpiderExample webSpider = new WebSpiderExample("http://www.httpunit.org");
    numLinks = webSpider.getNumLinks();  
    assertEquals("Testing method returns a value", numLinks, webSpider.getNumLinks());
  }
  
  /**
   *  Test the main method of WebSpiderExample.
   *  
   *  @throws Exception is thrown if test fails.
   */
  @Test
  public void testMainOperation() throws Exception {
    String[] arguments = {"http://www.httpunit.org" , "100"};
    WebSpiderExample.main(arguments);
    assertNotNull("Test that arguments are not Null", arguments);
  }
}
